<template>
	<view class="bankWrapper">
		<view class="item name">
			<view class="title">账号:</view>
			<input placeholder="一般情况下,请使用手机号" v-model="account" class="inputitem"></input>
		</view>
		<view class="item code">
			<view class="title">电话:</view>
			<input type="digit" placeholder="手机号码" v-model="phone" class="inputitem"></input>
		</view>
		<view class="item bankname">
			<view class="title">姓名:</view>
			<input placeholder="员工的姓名" v-model="name" class="inputitem"></input>
		</view>
		<view class="add" v-on:click="onAdd">立即添加</view>
	</view>
</template>

<script>
	import http from '../../common/http.js';
	import common from '../../common/common.js';
	export default {
		data() {
			return {
				account:"",
				name:"",
				phone:""
			}
		},
		methods: {
			onAdd () {
				if (this.account.length == 0) {
					uni.showToast({
						icon:"none",
						title:"请输入账号"
					})
					return
				}
				if (this.phone.length == 0) {
					uni.showToast({
						icon:"none",
						title:"请输入手机号码"
					})
					return
				}
				if (this.name.length == 0) {
					uni.showToast({
						icon:"none",
						title:"用户姓名"
					})
					return
				}
				
				var params = {
					
					"account":this.account,
					"phone":this.phone,
					"name":this.name
				}
				http.post("/store/staffadd", params, (res)=>{
					uni.showToast({
						icon:"none",
						title:"添加成功",
						success() {
							uni.navigateBack()
						}
					})
				})
			}
		}
	}
</script>

<style>
	.item .title {
		font-size: 18px;
		height: 35px;
		margin-top: 10px;
	}
	.bankWrapper {
		padding: 10px 15px;
	}
	.inputitem {
		background-color: #f3f3f2;
		height: 44px;
		padding: 0 10px;
		border-radius: 10px;
		line-height: 44px;
		color: #666666;
		box-sizing: border-box;
	}
	.content {
		height: 44px;
		line-height: 44px;
		width: 100%;
		position: relative;
	}
	.add {

		background-color:#007AFF;
		color: white;
		height: 50px;
		font-size: 18px;
		line-height: 50px;
		text-align: center;
		border-radius: 25px;
		margin-top: 30px;
		
	}
</style>
